/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Mail;

import java.util.LinkedList;
import java.util.List;

/**
 *
 * @author Frooz
 */
public class MailServer {

 List<Message> messages;
 MailClient cliente;
 
 public MailServer(){
     messages=new LinkedList<>();
     //cliente.usuario=name;
 }
 public MailServer(String name){
     messages=new LinkedList<>();
     cliente=new MailClient(name);
     
 }
 
 
 public int getMessagesWaiting(String name){
     int c=0;
     
     for (int i = 0; i < messages.size(); i++) {
         if (messages.get(i).getDestinatario().equals(name))
             c++;
     }
     return c;
 }
 
 public Message getNextMessage(String nameuser){
     
     return null;
     
 }
 
}
